using System;
using System.Collections.Generic;
using System.Text;
using Xyne.Network;
using Microsoft.Xna.Framework.Net;

namespace Xyne.Events
{
    /// <summary>
    /// Someone wants to pause the game.
    /// </summary>
    public class GamePauseEvent : Event
    {
        // The player that paused the game
        private String gamerTag;
        // If the event is meant to pause or unpause the game
        private Boolean pause;

        public Boolean Pause
        {
            get { return pause; }
        }

        public String Gamer
        {
            get { return gamerTag; }
            set { gamerTag = value; }
        }

        public GamePauseEvent(Object source, bool pause, String player)
            : base(source)
        {
            DataType = NetworkDataType.GamePause;
            this.gamerTag = player;
            this.pause = pause;
        }

        public static GamePauseEvent Deserialize(PacketReader reader)
        {
            return new GamePauseEvent(null, reader.ReadBoolean(), reader.ReadString());
        }

        public override void Serialize(PacketWriter writer)
        {
            writer.Write(pause);
            writer.Write(gamerTag);
        }
    }
}
